package com.yzr.common.result;

/**
 * @author      yzr
 * @date        2021/04/07 17:51
 * @description 对象返回格式
 **/
public class CommonResult<T> extends BaseResult {

    private static final long serialVersionUID = -8357618384041486871L;

    private T data;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static <T> CommonResult<T> buildData(T data) {
        CommonResult<T> result = new CommonResult<>();
        result.setData(data);
        result.setSuccess(true);
        result.setCode(com.yzr.common.util.result.ResultCode.SUCCESS.getCode());
        result.setMessage(com.yzr.common.util.result.ResultCode.SUCCESS.getMessage());
        return result;
    }

}
